from typing import Optional
from com.linkstec.dao.company_info_dao import CompanyInfoDao
from com.linkstec.models.company_info import CompanyInfo
from com.linkstec.utils.db_utils import TransactionContext



class CompanyInfoService:
    def get_company_info(self, secc_name: str) -> Optional[CompanyInfo]:
        """获取单个公司名称"""
        with TransactionContext() as conn:
            return CompanyInfoDao(conn).find_by_name(secc_name)

    def list_company_info(self) -> list[CompanyInfo]:
        """获取所有公司名称"""
        with TransactionContext() as conn:
            return CompanyInfoDao(conn).find_all()